unit MainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls , GetUserHeadPic;

type
  TfrmMain = class(TForm)
    imgUser: TImage;
    lblTitleOS: TLabel;
    lblOsName: TLabel;
    lblTitleUserName: TLabel;
    lblUserName: TLabel;
    lblTitlePic: TLabel;
    procedure FormShow(Sender: TObject);
  private
     function GetSystemStr(systemNum:Extended):string;
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation

{$R *.dfm}

procedure TfrmMain.FormShow(Sender: TObject);
var
  userPic:TBitmap;
begin
  lblOsName.Caption := GetSystemStr(GetSystem);
  lblUserName.Caption := GetName;

  userPic:= TBitmap.Create;
  GetUserHeadBmp(userPic);
  imgUser.Picture.Bitmap := userPic;
  userPic.Free;

end;

function TfrmMain.GetSystemStr(systemNum: Extended): string;
begin
  if systemNum=5.0 then
  Result := 'Windows 2000'
  else if systemNum=5.1 then
  Result := 'Windows Xp'
  else if systemNum=5.2 then
  Result := 'Windows 2003'
  else if systemNum=6.0 then
  Result := 'Windows vista'
  else if systemNum=6.1 then
  Result := 'Windows 7'
  else if systemNum=6.2 then
  Result := 'Windows 8'
  else if systemNum=6.3 then
  Result := 'Windows 8.1'
  else
    Result := 'Windows ??';
end;

end.
